package org.ccay.security.listener;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;

import org.ccay.core.session.Session;

/**
 * org.apache.shiro.session.Session 到org.ccay.core.session.Session的适配器
 */
public class SessionAdapter implements Session{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public SessionAdapter(org.apache.shiro.session.Session session) {
		this.session = session;
	}

	private org.apache.shiro.session.Session session;

	public org.apache.shiro.session.Session getSession() {
		return session;
	}

	public void setSession(org.apache.shiro.session.Session session) {
		this.session = session;
	}

	@Override
	public Serializable getId() {
		return session.getId();
	}

	@Override
	public Date getStartTimestamp() {
		return session.getStartTimestamp();
	}

	@Override
	public Date getLastAccessTime() {
		return session.getLastAccessTime();
	}

	@Override
	public long getTimeout() {
		return session.getTimeout();
	}

	@Override
	public void setTimeout(long maxIdleTimeInMillis) {
		session.setTimeout(maxIdleTimeInMillis);
	}

	@Override
	public String getHost() {
		return session.getHost();
	}

	@Override
	public void touch() {
		session.touch();
	}

	@Override
	public void stop() {
		session.stop();
		
	}

	@Override
	public Collection<Object> getAttributeKeys() {
		return session.getAttributeKeys();
	}

	@Override
	public Object getAttribute(Object key) {
		return session.getAttribute(key);
	}

	@Override
	public void setAttribute(Object key, Object value) {
		session.setAttribute(key, value);
		
	}

	@Override
	public Object removeAttribute(Object key) {
		return session.removeAttribute(key);
	}

}
